#include <iostream>
using namespace std;
bool check(int a) {
    if(a == 2) return true;
    if(a % 2 == 0) return false;
    for(int i = 3; (long long)i * i <= a; i++) {
        if(a % i == 0) return false;
    }
    return true;
}
int solve(int a)
{
    for (int i = 2; (long long)i * i <= a; i++)
    {
        if(a % i == 0) {
            if(check(i)) return a / i;
        }
    }
    return 0;
}
int main()
{
    int x;
    cin >> x;
    if(check(x)) {
        cout << x << endl;
        return 0;
    }
    int ans = solve(x);
    cout << ans << endl;
    return 0;
}